Skip to content

Conversation

oliveror
Copy link
Member

Changes

  • Changing page in Explore or My Cookbook scrolled to the top but left keyboard focus on the pagination button at the bottom, so keyboard and screen-reader users lost their place.
  • Both pages now move focus to the (visually hidden) results heading after a page change. The heading stays mounted while the next page loads, and the result count after it is already a live region.
  • New unit test: after clicking Next page, focus is on the results heading.

Validation

Remaining work

  • None for this issue.

AI usage

Written with Claude Code (Anthropic) during the final-delivery review. The change was implemented and tested by the AI agent and pushed from my account. Please review the diff as you would any other contribution.

Closes #81

Changing page scrolled to the top but left keyboard focus on the
pagination button at the bottom, so keyboard and screen-reader users lost
their place. Explore and Cookbook now focus the results heading, which
stays mounted while the next page loads.

Closes #81
Copy link
Member

@olestan olestan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes to address two remaining accessibility concerns:

  • Invisible keyboard focus: Both pages move focus to an .sr-only heading after pagination. Sighted keyboard users therefore lose the visible focus indicator. Consider making the heading visible on focus or targeting a visible results element.
  • Unreliable screen-reader announcements: Focus moves before the new results load, while the role="status" result count is unmounted during loading. This may prevent screen readers from announcing the updated page. Consider keeping the live region mounted and updating it once results arrive.

Review on #91: focusing the sr-only heading left sighted keyboard users
without a visible focus ring, and the result count (role=status) was
unmounted while the next page loaded, so the update might not be
announced. Explore and Cookbook now keep the count mounted (showing
"Loading recipes…" while loading) and move focus to it; it is visible
text, so the global :focus-visible ring shows.

Refs #81
@oliveror
Copy link
Member Author

Thanks, both points were right. Changed in the latest commit:

  • Visible focus: paging now moves focus to the result count ("7 recipes found"), which is visible text with tabIndex={-1}. After keyboard activation the global :focus-visible outline shows (checked in Chromium: focused, outline-style: solid). The results heading is back to a plain sr-only heading.
  • Reliable announcements: the count paragraph (role="status") is now always mounted. It shows "Loading recipes…" while the next page loads and then the new count, including "Page 2 of 2" for screen readers. Loading is no longer rendered by a separate element on these pages (RecipeQueryStatus still shows errors and Retry).

The unit test now checks that the same count element (so it stayed mounted) has focus and reads "7 recipes found. Page 2 of 2." after paging. npm run check and the smoke tests pass.

@oliveror oliveror merged commit a1de47d into dev Nov 16, 2026
2 checks passed
@oliveror oliveror deleted the fix/a11y-pagination-focus branch November 17, 2026 00:30
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants